<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // console.log(localStorage);
      // 获取
      console.log(localStorage.getItem("token"));
      console.log(localStorage.token);
      // 设置
      // localStorage.setItem("role", "user"); // localStorage.role = "abc123";
      // localStorage.token = "abc123";

      // 获取字段的个数
      console.log(localStorage.length);
      // 清空
      // localStorage.clear();
    </script>
  </body>
</html>
